package com.ygqh.baby.service;

import com.ygqh.baby.ao.CommissionStatus;
import com.ygqh.baby.ao.Message;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.ResultSet;
import com.ygqh.baby.model.YgCommissionModel;
import com.ygqh.baby.po.YgCommission;
import com.ygqh.baby.po.YgUser;
import com.ygqh.baby.po.YgUserBalance;
import com.ygqh.baby.po.YgUserBank;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author admin
 */
public interface YgCommissionService {

	List<YgCommission> find(Long userId);

	int findCount(Long userId);

	YgCommission findById(Long id);

	int save(YgCommission ygCommission);

	int update(YgCommission ygCommission);

	int saveOrUpdate(YgCommission ygCommission);

	ResultSet<YgCommission> search(QueryInfo queryInfo, String userName, CommissionStatus status, String q);

	YgUserBank findUserBank(Long userId);

	/**
	 * 绑定银行卡(存在更新，不存在新增)
	 *
	 * @param userId
	 * @param bankId
	 * @param bankAccount
	 * @param bankName
	 * @param bankBranch
	 * @param bankNo
	 * @return
	 */
	int bindBank(Long userId, Long bankId, String bankAccount, String bankName, String bankBranch, String bankNo, String alipayCode);

	/**
	 * 申请提现
	 *
	 * @param userId
	 * @param userName
	 * @param commissionPrice
	 * @return
	 */
	@Deprecated
	int applyWithdrawals(Long userId, String userName, BigDecimal commissionPrice);

	int applyWithdrawals(Long userId, String userName, BigDecimal commissionPrice, String platformNo);

	/**
	 * 查询用户银行账户
	 *
	 * @return
	 */
	YgUserBank findBankInfo(Long userId);

	/**
	 * 提现记录model
	 *
	 * @param queryInfo
	 * @param id
	 * @param commissionStatus
	 * @return
	 */
	@Deprecated
	ResultSet<YgCommissionModel> searchModel(QueryInfo queryInfo, Long id, String[] commissionStatus);

	ResultSet<YgCommissionModel> searchModel(QueryInfo queryInfo, Long id, String[] commissionStatus, String platformNo);

	/**
	 * 提现
	 *
	 * @param user
	 * @param money
	 * @throws Exception
	 */
	@Deprecated
	Message withdraw(YgUser user, BigDecimal money) throws Exception;

	Message withdraw(YgUser user, BigDecimal money, String platformNo) throws Exception;

	YgCommissionModel findModelById(Long id);

	/**
	 * 后台更新申请单状态
	 *
	 * @return
	 */
	int updateWithdrawStatus(Long commissionId, CommissionStatus commissionStatus, String remark);

	void opWithdrawDetail(YgUserBalance balance, BigDecimal money, String remark);
}
